﻿<UserControl x:Class="Squiggle.UI.Controls.StatusHistoryViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:controls="clr-namespace:Squiggle.UI.Controls"
             xmlns:converters="clr-namespace:Squiggle.UI.Converters"    
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="586">
    <UserControl.Resources>
        <converters:StatusConverter x:Key="statusConverter" />
    </UserControl.Resources>
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="30" />
                <RowDefinition Height="40" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="110" />
                <ColumnDefinition Width="454*" />
            </Grid.ColumnDefinitions>
            <Label Content="{DynamicResource HistoryViewer_FromDate}" Margin="0,0,35,0" />
            <DatePicker x:Name="txtFrom" Grid.ColumnSpan="2" Margin="75,0,0,0" />
            <Label Grid.Row="1" Content="{DynamicResource HistoryViewer_ToDate}" Margin="0,0,35,0" />
            <DatePicker Grid.Row="1" x:Name="txtTo" Grid.ColumnSpan="2" Margin="75,0,0,0" />
            <StackPanel Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
                <Button Margin="5" Click="Clear_Click" Content="{DynamicResource HistoryViewer_Clear}" />
                <Button Width="50" Margin="5" Click="Search_Click" Content="{DynamicResource HistoryViewer_Search}" IsDefault="True" />
            </StackPanel>
            <ListView Grid.Row="3" Grid.ColumnSpan="2" x:Name="results">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="{DynamicResource HistoryViewer_Results_Time}" DisplayMemberBinding="{Binding Time}" Width="140" />
                        <GridViewColumn Header="{DynamicResource HistoryViewer_Results_Name}" DisplayMemberBinding="{Binding Name}" Width="140" />
                        <GridViewColumn Header="{DynamicResource HistoryViewer_Results_Status}" DisplayMemberBinding="{Binding Status}" Width="140">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Converter={StaticResource statusConverter}}" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
        </Grid>
        <controls:BusyIndicator x:Name="busyIndicator" Message="{DynamicResource HistoryViewer_Searching}" />
    </Grid>
</UserControl>
